package com.twq.collection.framework

/**
 * Created by tangweiqun on 2017/12/10.
 */
object IteratorsTest {
  def main(args: Array[String]): Unit = {
    val it = Iterator("a", "number", "of", "words")

    val iterator = List(1, 2, 3).iterator

    while (it.hasNext)
      println(it.next())

    it foreach println

    it.next()

    for (elem <- it) println(elem)

    it.map(_.length)

    it dropWhile (_.length < 2)

    it.next()

    val (it1, it2) = it.duplicate
  }
}
